package com.euond.accv.mdm.api.controller;

import com.euond.accv.mdm.client.dto.MdmCustomerDTO;
import com.euond.accv.mdm.domain.MdmCustomer;
import com.euond.accv.mdm.service.MdmCustomerService;
import com.euond.common.api.controller.BaseReadApiController;
import com.euond.common.web.controller.annotation.FeignRestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by liqi on 2017/3/16.
 */
@FeignRestController
@RequestMapping("/feign_api/mdm_customer")
@Api(description = "客户资料Api")
public class MdmCustomerApiController extends BaseReadApiController<MdmCustomer, String> {

    @Autowired
    MdmCustomerService service;

    @Override
    protected void init() {
        setBaseService(service);
        setMainVOClazz(MdmCustomerDTO.class);
    }

    @ApiOperation(value = "根据客户编号查询客户信息", httpMethod="GET")
    @GetMapping("/findCustomerByNo")
    public List<MdmCustomerDTO> findCustomerByNo(@RequestParam("customerNo") String customerNo){
        List<MdmCustomerDTO> dtoList = service.findCustomerByNo(customerNo);

        return dtoList;
    }
}
